import {request} from "@/utils/http";
import type {
  getHosListSearchParamsType,
  hospitalListReqReturnType,
  getProvinceReturnType,
  hosScheduleListType,
  hosScheduleRuleReturnType,
  hosScheduleRuleParamsType,
  scheduleWorkDateReqType,
  getScheduleWorkDateType
} from "./model/hospitalListTypes"
import {getHosDetailType} from "./model/hospitalListTypes";

//1.设置列表请求
export const getHosListRequest = (page: number, limit: number, searchParams: getHosListSearchParamsType) => {
  return request.get<any, hospitalListReqReturnType>(`/admin/hosp/hospital/${page}/${limit}`, {
    params: searchParams
  })
}

//2.设置更改status请求
export const getHosStatusRequest = (id:string,status:0|1) => {
  return request.get<any,null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`)
}

//3.获取省份的请求
export const getProvinceRequest = () =>{
  return request.get<any,getProvinceReturnType>('/admin/cmn/dict/findByDictCode/province')
}
//4.更具省编号获取市的请求
export const getCityOrDistrictListRequest = (value:string) => {
  return request.get<any,getProvinceReturnType>(`/admin/cmn/dict/findByParentId/${value}`)
}

//5.获取医院等级的请求
export const getHosTypeRequest = () => {
  return request.get<any,getProvinceReturnType>(`/admin/cmn/dict/findByParentId/${1000}`)
}

//6.获取医院详细信息的请求
export const getHosDetailRequest = (id:string|undefined) => {
  return request.get<any,getHosDetailType>(`/admin/hosp/hospital/show/${id}`)
}

//7.医院所有科室的请求
export const hosScheduleListRequest = (hoscode: string) => {
  return request.get<any, hosScheduleListType>(`/admin/hosp/department/${hoscode}`);
};

//8.某个科室的详细排班时间请求
export const hosScheduleRuleRequest = ({ page, limit, hoscode, depcode }: hosScheduleRuleParamsType) => {
  return request.get<any, hosScheduleRuleReturnType>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}

//9.获取某个科室的当日的详细排班列表

export const getHosWorkDateScheduleRequest = ({hoscode,depcode,workDate}:scheduleWorkDateReqType) =>{
  return request.get<any,getScheduleWorkDateType>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}
